package com.example.beautymakeup.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * 抖音开放平台配置类
 */
@Configuration
public class DouyinConfig {
    @Value("${douyin.client-id}")
    private String clientId;

    @Value("${douyin.client-secret}")
    private String clientSecret;

        /**
     * 授权临时票据（需通过OAuth流程获取）
     * 警告：测试阶段可使用固定值，生产环境必须动态获取
     */
    @Value("${douyin.auth-code}")
    private String authCode;

    // OAuth2.0授权相关接口
        /**
     * OAuth2.0授权接口地址
     * - connect: 用户授权页面地址
     * - access_token: 获取访问令牌接口
     * - refresh_token: 刷新访问令牌接口
     */
    public static final String OAUTH_AUTHORIZE = "https://open.douyin.com/oauth/authorize/";
    public static final String OAUTH_ACCESS_TOKEN = "https://open.douyin.com/api/douyin/v1/oauth/access_token/";
    public static final String OAUTH_REFRESH_TOKEN = "https://open.douyin.com/api/douyin/v1/oauth/refresh_token/";

    /**
     * 用户开放信息接口
     * - 需scope包含user_info
     */
    public static final String USER_INFO = "https://open.douyin.com/api/douyin/v1/user/user_info/";

    /**
     * 支付接口地址（V2版本）
     * - create_order: 统一下单接口
     * - query_order: 订单查询接口
     * - callback: 支付结果回调地址（需在抖音后台配置）
     */
    public static final String PAY_CREATE_ORDER = "https://open.douyin.com/api/payment/v2/create_order/";
    public static final String PAY_QUERY_ORDER = "https://open.douyin.com/api/payment/v2/query_order/";
    public static final String PAY_CALLBACK_URL = "https://your-domain.com/api/payment/douyin/callback";

    public String getAuthUrl() {
        return OAUTH_AUTHORIZE;
    }

    public String getTokenUrl() {
        return OAUTH_ACCESS_TOKEN;
    }

    public String getOrderQueryUrl() {
        return PAY_QUERY_ORDER;
    }

    // 获取client_id和secret的getter方法
    public String getClientId() {
        return clientId;
    }

    public String getClientSecret() {
        return clientSecret;
    }
    public String getAuthCode() {
        return authCode;
    }
}